<template>
	<view class="">
		<!-- 搜索框 -->
		<view class="search">
			<!-- <view class="incofont icon-search"></view> -->
			<input type="text" value="搜索" />
		</view>
		<!-- 轮播图 -->
		<view>
			<view class="uni-margin-wrap">
				<swiper circular class="swiper" :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000">
					<swiper-item v-for="(item,index) in swiperList" :key="index">
						<view class="swiper-item">
							<image :src="item.image_src" mode=""></image>
						</view>
					</swiper-item>
					<!-- <swiper-item>
						<view class="swiper-item">
							<image src="https://static.botue.com/ugo/uploads/banner2.png" mode=""></image>
						</view>
					</swiper-item>
					<swiper-item>
						<view class="swiper-item">
							<image src="https://static.botue.com/ugo/uploads/banner3.png" mode=""></image>
						</view>
					</swiper-item> -->
				</swiper>
			</view>
		</view>
		
		<!-- 四个小图标 -->
		<view class="ul">
			<view class="li">
				<image src="https://static.botue.com/ugo/uploads/icon_index_nav_4@2x.png" mode=""></image>
				<!-- <text>分类</text> -->
			</view>
			<view class="li">
				<image src="https://static.botue.com/ugo/uploads/icon_index_nav_3@2x.png" mode=""></image>
				<!-- <text>秒杀拍</text> -->
			</view>
			<view class="li">
				<image src="https://static.botue.com/ugo/uploads/icon_index_nav_2@2x.png" mode=""></image>
				<!-- <text>超市购</text> -->
			</view>
			<view class="li">
				<image src="https://static.botue.com/ugo/uploads/icon_index_nav_1@2x.png" mode=""></image>
				<!-- <text>母婴品</text> -->
			</view>
		</view>
		
		<!-- 楼层 -->
		<view class="list">
			<view class="top">
				<image src="https://static.botue.com/ugo/uploads/pic_floor01_title.png" mode=""></image>
			</view>
			<view class="bottom">
				<view class="left">
					<image src="https://static.botue.com/ugo/uploads/pic_floor01_1@2x.png" mode=""></image>
				</view>
				<view class="right">
					<image src="https://static.botue.com/ugo/uploads/pic_floor01_2@2x.png" mode=""></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { swiperdata } from "@/api/shouye_request.js";
	export default {
		data() {
			return {
				swiperList:[]
			}
		},
		onLoad() {
			this.getSwiperData();
		},
		methods:{
			// 发送网络数据请求
			async getSwiperData(){
				const {data:res} = await swiperdata();
				console.log(res);
				// res 相当于result.data
				// console.log(result.data);
				// 在data当中设计初始值 在template当中进行渲染
				if(res.meta.status !== 200){
					return uni.showToast({
						title:"数据请求失败！",
						inco:"none",
					})
				}
				this.swiperList = res.message
			}
		}
	}
</script>

<style lang="scss" scoped>
	.search {
		width: 100%;
		height: 100rpx;
		background-color: #C00000;
		display: flex;
		justify-content: center;
		align-items: center;

		input {
			width: 94%;
			height: 72rpx;
			line-height: 72rpx;
			background-color: #FFFFFF;
			text-align: center;
			border-radius: 20px;
		}
	}

	.uni-margin-wrap {
		width: 690rpx;
		width: 100%;
		// height: 350px;

		.swiper {
			width: 100%;
			height: 350rpx;

			.swiper-item {
				display: block;
				width: 100%;
				height: 300rpx;
				line-height: 300rpx;
				text-align: center;
				image{
					width: 100%;
					height: 170px;
				}
			}
		}
	}
	.ul{
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin: 10px;
		.li{
			width: 18%;
			image{
				width: 130rpx;
				height: 140rpx;
			}
		}
	}
	.list{
		.top{
			image{
				height: 30px;
			}
		}
	}
</style>
